import React, { useState, useCallback, memo } from 'react'
export default function ParentComponent() {
  let [count, setCount] = useState(0)
  let Count = 0
  const childClick = useCallback(() => {
    console.log("you click child")
  }, [])
  function parentClick() {
    console.log("you click parent")
    Count++
    setCount(Count)
  }
  return (
    <div>
      <h1>{count}</h1>
      <div onClick={parentClick}>ParentComponent</div>
      <ChildComponent childClick={childClick}></ChildComponent>
    </div>
  )
}
const ChildComponent = memo((props) => {
  console.log("ChildComponent is runing")
  return <div onClick={props.childClick}>ChildComponent</div>
})
